package com.kystar.muxplayer.protocol.code.get;

import com.kystar.muxplayer.model.Version;
import com.kystar.muxplayer.protocol.CodeCmd;

public class CG93_Version extends CodeCmd {
    public CG93_Version() {
        super(CODE_OK);
    }

    @Override
    public byte getCode() {
        return (byte) 0x93;
    }

    public Version getVersion() {
        Version version = new Version();
        version.setIp(byteToInt(mResult[0])+"."+byteToInt(mResult[1])+"."+byteToInt(mResult[2])+"."+byteToInt(mResult[3]));
        version.setArmVersion(String.format("%02d%02d%02dV%d.%d",
            byteToInt(mResult[4]),
            byteToInt(mResult[5]),
            byteToInt(mResult[6]),
            byteToInt(mResult[7]),
            byteToInt(mResult[8])
            ));
        version.setFpgaVersion(String.format("%02d%02d%02dV%d.%d",
            byteToInt(mResult[14]),
            byteToInt(mResult[15]),
            byteToInt(mResult[16]),
            byteToInt(mResult[17]),
            byteToInt(mResult[18])
            ));
        return version;
    }

    public static CG93_Version create() {
        return new CG93_Version();
    }
}
